package com.nc.delivery_project.shared.locator;
import com.google.web.bindery.requestfactory.shared.Locator;
import com.nc.delivery_project.server.domain.Schedule;
import com.nc.delivery_project.server.service.ScheduleService;
import com.nc.delivery_project.shared.servicelocator.ScheduleServiceLocator;
/**
 * Created by DRAGON on 28.01.2015.
 */
public class ScheduleLocator extends Locator<Schedule, Integer> {

    @Override
    public Schedule create(Class<? extends Schedule> clazz) {
        return new Schedule();
    }


    @Override
    public Schedule find(Class<? extends Schedule> clazz, Integer id) {
        return ((ScheduleService) new ScheduleServiceLocator().getInstance(null)).read(id);
    }

    @Override
    public Class<Schedule> getDomainType() {
        return Schedule.class;
    }

    @Override
    public Integer getId(Schedule domainObject) {
        return domainObject.getId();
    }

    @Override
    public Class<Integer> getIdType() {
        return Integer.class;
    }

    @Override
    public Object getVersion(Schedule domainObject) {
        return domainObject.getId();
    }
}
